package com.yida.gwj.deposit.service.impl;

import com.yida.common.core.utils.DateUtils;
import com.yida.common.security.utils.SecurityUtils;
import com.yida.gwj.deposit.domain.GwjDepositBusinessCommunity;
import com.yida.gwj.deposit.mapper.GwjDepositBusinessCommunityMapper;
import com.yida.gwj.deposit.service.IGwjDepositBusinessCommunityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务小区信息（缴存业务管理模块）Service业务层处理
 *
 * @author lqq
 * @date 2023-01-10
 */
@Service
public class GwjDepositBusinessCommunityServiceImpl implements IGwjDepositBusinessCommunityService {
	@Autowired
	private GwjDepositBusinessCommunityMapper gwjDepositBusinessCommunityMapper;

	/**
	 * 查询业务小区信息（缴存业务管理模块）
	 *
	 * @param bizCommunityId 业务小区信息（缴存业务管理模块）主键
	 * @return 业务小区信息（缴存业务管理模块）
	 */
	@Override
	public GwjDepositBusinessCommunity selectGwjDepositBusinessCommunityByBizCommunityId(Long bizCommunityId) {
		return gwjDepositBusinessCommunityMapper.selectGwjDepositBusinessCommunityByBizCommunityId(bizCommunityId);
	}

	/**
	 * 查询业务小区信息（缴存业务管理模块）列表
	 *
	 * @param gwjDepositBusinessCommunity 业务小区信息（缴存业务管理模块）
	 * @return 业务小区信息（缴存业务管理模块）
	 */
	@Override
	public List<GwjDepositBusinessCommunity> selectGwjDepositBusinessCommunityList(GwjDepositBusinessCommunity gwjDepositBusinessCommunity) {
		return gwjDepositBusinessCommunityMapper.selectGwjDepositBusinessCommunityList(gwjDepositBusinessCommunity);
	}

	/**
	 * 新增业务小区信息（缴存业务管理模块）
	 *
	 * @param gwjDepositBusinessCommunity 业务小区信息（缴存业务管理模块）
	 * @return 结果
	 */
	@Override
	public int insertGwjDepositBusinessCommunity(GwjDepositBusinessCommunity gwjDepositBusinessCommunity) {
		gwjDepositBusinessCommunity.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getRealName());
		gwjDepositBusinessCommunity.setCreateTime(DateUtils.getNowDate());
		return gwjDepositBusinessCommunityMapper.insertGwjDepositBusinessCommunity(gwjDepositBusinessCommunity);
	}

	/**
	 * 修改业务小区信息（缴存业务管理模块）
	 *
	 * @param gwjDepositBusinessCommunity 业务小区信息（缴存业务管理模块）
	 * @return 结果
	 */
	@Override
	public int updateGwjDepositBusinessCommunity(GwjDepositBusinessCommunity gwjDepositBusinessCommunity) {
		gwjDepositBusinessCommunity.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getRealName());
		gwjDepositBusinessCommunity.setUpdateTime(DateUtils.getNowDate());
		return gwjDepositBusinessCommunityMapper.updateGwjDepositBusinessCommunity(gwjDepositBusinessCommunity);
	}

	/**
	 * 批量删除业务小区信息（缴存业务管理模块）
	 *
	 * @param bizCommunityIds 需要删除的业务小区信息（缴存业务管理模块）主键
	 * @return 结果
	 */
	@Override
	public int deleteGwjDepositBusinessCommunityByBizCommunityIds(Long[] bizCommunityIds) {
		return gwjDepositBusinessCommunityMapper.deleteGwjDepositBusinessCommunityByBizCommunityIds(bizCommunityIds);
	}

	/**
	 * 删除业务小区信息（缴存业务管理模块）信息
	 *
	 * @param bizCommunityId 业务小区信息（缴存业务管理模块）主键
	 * @return 结果
	 */
	@Override
	public int deleteGwjDepositBusinessCommunityByBizCommunityId(Long bizCommunityId) {
		return gwjDepositBusinessCommunityMapper.deleteGwjDepositBusinessCommunityByBizCommunityId(bizCommunityId);
	}

	/**
	 * 根据业务ID删除业务小区信息（缴存业务管理模块）信息
	 *
	 * @param bizId 业务ID
	 * @return 结果
	 */
	@Override
	public int deleteGwjDepositBusinessCommunityByBizId(Long bizId) {
		return gwjDepositBusinessCommunityMapper.deleteGwjDepositBusinessCommunityByBizId(bizId);
	}

	/**
	 * 通过业务ID查询业务小区信息（缴存业务管理模块）列表
	 *
	 * @param bizId 业务ID
	 * @return 业务小区信息（缴存业务管理模块）集合
	 */
	@Override
	public List<GwjDepositBusinessCommunity> selectGwjDepositBusinessCommunityListByBizId(Long bizId) {
		GwjDepositBusinessCommunity gwjDepositBusinessCommunity = new GwjDepositBusinessCommunity();
		gwjDepositBusinessCommunity.setBizCommunityId(bizId);
		return gwjDepositBusinessCommunityMapper.selectGwjDepositBusinessCommunityList(gwjDepositBusinessCommunity);
	}

	/**
	 * 根据业务ID查询业务小区信息（缴存业务管理模块）
	 *
	 * @param bizId 业务ID
	 * @return 业务小区信息（缴存业务管理模块）
	 */
	@Override
	public GwjDepositBusinessCommunity selectGwjDepositBusinessCommunityByBizId(Long bizId) {
		GwjDepositBusinessCommunity gwjDepositBusinessCommunity = new GwjDepositBusinessCommunity();
		gwjDepositBusinessCommunity.setBizId(bizId);
		return gwjDepositBusinessCommunityMapper.selectGwjDepositBusinessCommunity(gwjDepositBusinessCommunity);
	}
}
